package it.asvp.asvp_portal.data.entity.domain;


import static javax.persistence.GenerationType.IDENTITY;
import it.asvp.asvp_portal.data.entity.member.Member;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@SuppressWarnings("serial")
@Entity
@Table(name = "sport", catalog = "asvp_db")
public class Sport extends BaseEntity {

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	private Long id;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_member", nullable = false)
	private Member member;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_address")
	@Cascade({CascadeType.ALL})
	private Address address;
	
	@Column(name = "institution", nullable = false, length = 100)
	private String institution;
	
	@Column(name = "description", nullable = false, length = 500)
	private String description;
	
	@Column(name = "phone", length = 20)
	private String phone;
	
	@Column(name = "fax", length = 20)
	private String fax;
	
	@Column(name = "email", nullable = false, length = 100)
	private String email;
	
	@Column(name = "website_link", length = 100)
	private String websiteLink;
	
	public Sport() {
	}

	public Sport(Member member, Address address, String institution,
			String description, String phone, String fax, String email,
			String websiteLink, Date createdOn, Date lastUpdate) {
		this.member = member;
		this.address = address;
		this.institution = institution;
		this.description = description;
		this.phone = phone;
		this.fax = fax;
		this.email = email;
		this.websiteLink = websiteLink;
		this.createdOn = createdOn;
		this.lastUpdate = lastUpdate;
	}

	
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	
	public Member getMember() {
		return this.member;
	}

	public void setMember(Member member) {
		this.member = member;
	}


	public Address getAddress() {
		return this.address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}


	public String getInstitution() {
		return this.institution;
	}

	public void setInstitution(String institution) {
		this.institution = institution;
	}

	
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}


	public String getFax() {
		return this.fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}


	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}


	public String getWebsiteLink() {
		return this.websiteLink;
	}

	public void setWebsiteLink(String websiteLink) {
		this.websiteLink = websiteLink;
	}

}
